@extends('admin/layout')

@section('header')
    <!-- DataTables CSS -->
    {{ HTML::style('admin/css/plugins/dataTables.bootstrap.css'); }}
@stop

@section('content')
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header"><?=$fnTitle?></h1>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    Users
                </div>
                <!-- /.panel-heading -->
                <div class="panel-body">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover" id="admin-dataTables">
                            <thead>
                                <tr>
                                    @foreach( $tableTitles as $val )
                                        <th>{{ $val }}</th>
                                    @endforeach
                                </tr>
                            </thead>
                            
                            <tbody>
                                @if ($variable = 'id') @endif
                                @foreach( $items as $item )
                                <tr class="odd gradeX">
                                    @foreach( $tableKeys as $val )
                                        @if ( ! in_array( $val, array( 'restore', 'update', 'trash' ) ) )    
                                        <td>{{ $item->$val }}</td>
                                        @endif
                                    @endforeach
                                    
                                    @if ( in_array( 'update', $links ) )
                                    <td class="center"><a href="/at-admin/{{ $module }}/update/{{ $item->id }}">[Update]</a></td>
                                    @endif
                                    
                                    @if ( in_array( 'trash', $links ) )
                                    <td class="center"><a href="/at-admin/{{ $module }}/trash/{{ $item->id }}">[Trash]</a></td>
                                    @endif
                                    
                                    @if ( in_array( 'restore', $links ) )
                                    <td class="center"><a href="/at-admin/{{ $module }}/restore/{{ $item->id }}">[Restore]</a></td>
                                    @endif
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                    </div>
                    <!-- /.table-responsive -->
                </div>
                <!-- /.panel-body -->
            </div>
            <!-- /.panel -->
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
@stop

@section('footer')
    <!-- DataTables JavaScript -->
    {{ HTML::script('admin/js/plugins/dataTables/jquery.dataTables.js'); }}
    {{ HTML::script('admin/js/plugins/dataTables/dataTables.bootstrap.js'); }}
    <!-- Page-Level Demo Scripts - Tables - Use for reference -->
    <script>
    $(document).ready(function() {
        $('#admin-dataTables').dataTable();
    });
    </script>
@stop
